﻿<UserControl x:Class="HeritageAcademy.Library.Controls.TestScroller"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:HeritageAcademy.Library.Controls"
             xmlns:Model="clr-namespace:HeritageAcademy.Models.Loaders;assembly=HeritageAcademy.Models"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="356.212" d:DesignWidth="418">
    
    <UserControl.Resources>
        <Model:TestsConfigLoader x:Key="TestsDataModel" />
        <sys:Double x:Key="PageNumberLabelStyle">16</sys:Double>
    </UserControl.Resources>
    
    <Grid>
    	<Grid.RowDefinitions>
    		<RowDefinition/>
    		<RowDefinition Height="50"/>
    	</Grid.RowDefinitions>
        <!--<local:ZapScroller x:Name="zsTestScroller" ItemsSource="{Binding Source={StaticResource TestsDataModel}, Path=Titles}">-->
        <Border Grid.Row="1">
        	<Border.Background>
        		<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
        			<GradientStop Color="#00000000" Offset="0" />
        			<GradientStop Color="#18000000" Offset="1" />
        		</LinearGradientBrush>
        	</Border.Background>
        </Border>
        <Grid Margin="18,18,18,0">
<!--<local:ZapScroller x:Name="zsTestScroller" ItemsSource="{Binding Source={StaticResource TestsDataModel}, Path=Titles}">-->
        	<Border Background="{DynamicResource PageBackgroundBrush}" IsHitTestVisible="False">
        		<Border.Effect>
        			<DropShadowEffect Direction="-90" BlurRadius="12" ShadowDepth="3" Opacity="0.4" />
        		</Border.Effect>
        	</Border>
        <!--<local:ZapScroller x:Name="zsTestScroller" ItemsSource="{Binding Source={StaticResource TestsDataModel}, Path=Titles}">-->
        	<local:ZapScroller x:Name="zsTestScroller" Margin="40,40,0,0" FontSize="18.667">
        		<local:ZapScroller.Resources>
        			<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}" x:Key="pageButtonStyle">
        				<Setter Property="Width" Value="30" />
        				<Setter Property="Height" Value="30" />
        			</Style>

        			<Style TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource {x:Type RepeatButton}}" x:Key="pageRepeatButtonStyle">
        				<Setter Property="Width" Value="30" />
        				<Setter Property="Height" Value="30" />
        				<Setter Property="Interval" Value="500" />
        			</Style>

        			<DataTemplate DataType="{x:Type local:ZapCommandItem}" x:Key="DefaultZapCommandItemTemplate">
        				<Button Command="{Binding}" Style="{StaticResource pageButtonStyle}" Content="{Binding Number}"/>
        			</DataTemplate>

        			<DataTemplate DataType="{x:Type local:ZapScroller}" x:Key="DefaultZapPageNumberTemplate">
        				<Label Content="{Binding ItemCount}"/>
        			</DataTemplate>

        			<Style TargetType="{x:Type ItemsControl}" x:Key="ZapScrollerCommandItemsControlStyle">
        				<Setter Property="Focusable" Value="False"/>
        				<Setter Property="Template">
        					<Setter.Value>
        						<ControlTemplate TargetType="{x:Type ItemsControl}">
        							<StackPanel Orientation="Horizontal" IsItemsHost="True"/>
        						</ControlTemplate>
        					</Setter.Value>
        				</Setter>
        			</Style>

        			<Style TargetType="{x:Type local:ZapScroller}">
        				<Setter Property="CommandItemTemplate" Value="{StaticResource DefaultZapCommandItemTemplate}"/>
        				<Setter Property="Template">
        					<Setter.Value>
        						<ControlTemplate TargetType="{x:Type local:ZapScroller}">
        							<DockPanel>
                                                                       
        								<local:ZapDecorator x:Name="PART_ZapDecorator">
        									<local:ZapPanel IsItemsHost="true" />
        								</local:ZapDecorator>

        							</DockPanel>
        						</ControlTemplate>
        					</Setter.Value>
        				</Setter>
        			</Style>
        		</local:ZapScroller.Resources>
            
        		<local:ZapScroller.ItemTemplate>
        			<DataTemplate>
        				<Viewbox>
        					<TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" Margin="5" Width="Auto" Height="250"/>
        				</Viewbox>
        			</DataTemplate>
        		</local:ZapScroller.ItemTemplate>

        	</local:ZapScroller>
        </Grid>
        <Grid x:Name="BottomNavigation" Grid.Row="1" SnapsToDevicePixels="True" Height="Auto">
                
        	<Grid.Style>
        		<Style TargetType="{x:Type Grid}">
        			<!-- for TouchScreens
                        <Style.Triggers>
                        	<DataTrigger Binding="{Binding IsTouchResizeEnabled, Source={x:Static ViewModel:OptionsViewModel.Current}}" Value="True">
                        		<Setter Property="Height" Value="46" />
                        	</DataTrigger>
                        </Style.Triggers>-->
        			<Setter Property="Height" Value="40" />
        		</Style>
        	</Grid.Style>

        	<Grid.ColumnDefinitions>
        		<ColumnDefinition Width="0.3*" />
        		<ColumnDefinition Width="100" />
        		<ColumnDefinition Width="0.3*" />
        	</Grid.ColumnDefinitions>

        	<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" d:IsHidden="True" Grid.Column="1" VerticalAlignment="Center" >
        		<Label Content="1" HorizontalAlignment="Center" x:Name="CurrentPageNumber" FontSize="{DynamicResource PageNumberLabelStyle}" />
        		<Label Content="из" HorizontalAlignment="Center" FontSize="{DynamicResource PageNumberLabelStyle}"/>
        		<Label Content="" HorizontalAlignment="Center" x:Name="TotalPageNumber" FontSize="{DynamicResource PageNumberLabelStyle}"/>
        	</StackPanel>

            <!-- Next Page Button -->
        	<RepeatButton x:Name="NextPageButton" Grid.Column="2" Style="{DynamicResource OpacityRepeatButton}" Focusable="False" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" Cursor="Hand" Padding="0,0,18,0" ToolTip="Следующий вопрос" >
        		<local:Bitmap Source="/HeritageAcademy.Library;component/Images/arrow_next.png" />
        	</RepeatButton>

            <!-- Previous Page Button -->
        	<RepeatButton x:Name="PreviousPageButton" Grid.Column="0" Style="{DynamicResource OpacityRepeatButton}" Focusable="False" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Cursor="Hand" Padding="18,0,0,0" ToolTip="Предыдущий вопрос" >
        		<local:Bitmap Source="/HeritageAcademy.Library;component/Images/arrow_prev.png" />
        	</RepeatButton>

        </Grid>
        <!--<local:ZapScroller x:Name="zsTestScroller" ItemsSource="{Binding Source={StaticResource TestsDataModel}, Path=Titles}">-->
    </Grid>
</UserControl>
